﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WrokConfig.aspx.cs" Inherits="WinnerCMS.WebUI.Admin.Gather.WrokConfig" %>

<!doctype html>
<html>
<head id="Head1" runat="server">
    <title>采集</title>
    <%: Scripts.Render("~/Scripts/AdminBase") %>
    <%: Styles.Render("~/Content/Bootstrap/css") %>
    
    <script type="text/javascript" src="Quarry2.js"></script>
    <script type="text/javascript">

        var RowClone;
        var LogList_tbody;
        $(function () {
            RowClone = $("<tr><td class=\"time\"></td><td class=\"info\"></td></tr>");
            LogList_tbody = $('#LogList tbody');

            $("#Gatherthread").numberspinner({ min: 1, max: 100 });
        });
        function Message(url, info, state) {
            if (stoplog == true) {
                return;
            }
            var today = new Date();
            var time = today.format('hh:mm:ss:fff');
            if (state == 0 && $get("LogErr").checked == false) {
                return;
            }
            if (state == 1 && $get("LogRight").checked == false) {
                return;
            }
            if (state == 2 && $get("LogAlert").checked == false) {
                return;
            }
            var Row = RowClone.clone(true);
            Row.find("td").eq(0).html(time);

            if (url != null)
                Row.find("td").eq(1).html('<a href="' + url + '" target="_blank">' + url + '</a> <br />' + info);
            else
                Row.find("td").eq(1).html(info);

            LogList_tbody.prepend(Row);
        }

        var stoplog = false;
        function WriteLog(obj) {
            if (stoplog == false) {
                stoplog = true;
                obj.value = "开始日志";
            }
            else {
                stoplog = false;
                obj.value = "停止日志";
            }
        }
        function ClearLog() {
            LogList_tbody.find("tr").remove();
        }
    </script>
    <style type="text/css">
        #BadLinkNum, #Gatherthread {
            width: 28px;
        }

        label {
            cursor: pointer;
        }

        .time {
            width: 150px;
        }

        .info {
            text-align: left;
        }
        .icheckboxStyle td div {
            clear: both;
        }
        #divbuttonArea {
            margin-left: auto;margin-right: auto;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div style="width: 500px; height: 20px; margin-left: auto; margin-right: auto; text-align: center;">
            <a href="WrokConfigSilverlight.aspx?IDs=<%= Server.UrlEncode(Request["IDs"]) %>&ModelId=<%= Request["ModelId"] %>">Silverlight 版</a>
        </div>
        <table cellpadding="3" cellspacing="1" style="width: 740px; margin-left: auto; margin-right: auto">
            <tr class="icheckboxStyle">
                <td style="text-align: right; width: 240px">
                    <div>
                        <label for="IsTest">
                            测试采集</label>
                        <input id="IsTest" type="checkbox" />
                    </div>
                    <div>
                        <asp:CheckBox ID="Reverse" runat="server" Text="倒序采集" TextAlign="Left" />
                    </div>
                    <div>
                        <label for="IsUpdate">
                            更新模式</label>
                        <input id="IsUpdate" type="checkbox" />
                    </div>
                </td>
                <td style="text-align: right; width: 240px">
                    <div>
                        <label for="LogErr">
                            记录错误</label>
                        <input id="LogErr" type="checkbox" checked="checked" />
                    </div>
                    <div>
                        <label for="LogAlert">
                            记录警告</label>
                        <input id="LogAlert" type="checkbox" />
                    </div>
                    <div>
                        <label for="LogRight">
                            记录正常</label>
                        <input id="LogRight" type="checkbox" />
                    </div>
                </td>
                <td style="text-align: right; width: 240px;">
                    <div style="padding-right: 18px">
                        <label for="IsLeech">
                            反反盗链</label>
                        <input id="IsLeech" type="checkbox" />
                    </div>
                    <div>

                        <input id="Gatherthread" type="text" value="5" />
                        <span class="help-inline">同时采集</span>
                    </div>
                    <div>

                        <input id="BadLinkNum" type="text" value="0" /><span class="help-inline">容忍图片死链接</span>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: center;" colspan="3">
                    <div class="btn-toolbar">
                        <div class="btn-group" id="divbuttonArea" >
                            <input id="btnstart" type="button" onclick="Start();" class="btn btn-default" value="采集" />
                            <input id="btnstop" type="button" onclick="Stop();" class="btn btn-default" value="停止" disabled="disabled" />
                            <input type="button" onclick="WriteLog(this);" class="btn btn-default" value="停止日志" />
                            <input type="button" onclick="ClearLog(this);" class="btn btn-default" value="清空日志" />
                        </div>
                    </div>
                    <div style="text-align: center; font-weight: bold;">
                        当前采集 / 跳过采集： <span id="ProgressNum">0</span> / <span id="ProgressIgnoreNum">0</span>
                    </div>
                </td>
            </tr>
        </table>
        <table width="100%" cellspacing="0" id="LogList" class="table table-bordered table-condensed">
            <thead>
                <tr style="background-color: Black; color: White; height: 26px">
                    <td style="width: 150px">时间
                    </td>
                    <td style="text-align: center;">信息
                    </td>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </form>
</body>
</html>
